package com.object;

public class Dog implements Runnable { //通过实现Runnable接口来实现

    int count = 0;

    @Override
    public void run() { //普通方法
        while (true) {
            System.out.println("你好，玩家-" + (++count) + Thread.currentThread().getName());

            //休眠1秒
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            if (count == 10) {
                break;
            }
        }
    }
}
